<extend name="Public/layout" />
<style>
    .pagination {
        font-size: 0;
    }

    .pagination .page-item,
    .pagination .prev,
    .pagination .next,
    .pagination .dotted {
        display: inline-block;
        height: 32px;
        line-height: 32px;
        text-align: center;
        font-size: 14px;
    }

    .pagination .page-item,
    .pagination .prev,
    .pagination .next {
        border: 1px solid #ddd;
        color: #ddd;
        margin-left: 8px;
        vertical-align: top;
    }

    .pagination a.page-item,
    .pagination a.prev,
    .pagination a.next {
        color: #666666;
    }

    .pagination a.page-item:hover,
    .pagination a.prev:hover,
    .pagination a.next:hover {
        border-color: #ff7e00;
        color: #ff7e00;
        text-decoration: none;
    }

    .pagination .page-item {
        min-width: 24px;
        _width: 24px;
        padding: 0 4px;
        font-family: tahoma;
    }

    .pagination .prev,
    .pagination .next {
        width: 73px;
    }

    .pagination .prev {
        margin-left: 0;
    }

    .pagination .prev b {
        padding-right: 6px;
    }

    .pagination .next b {
        padding-left: 6px;
    }

    .pagination .dotted {
        margin: 0 5px 0 16px;
        color: #8C8C8C;
    }

    .pagination .current {
        background: #ff7e00;
        border-color: #ff7e00;
        color: #fff !important;
    }

    .num {
        padding: 10px;
        background: #00a157;
        border: 1px solid #00acd6;
    }
</style>
<block name="body">
    <div class="row">
        <div class="col-xs-12">
            <style type="text/css">
                .ah td {
                    padding: 20px 5px;
                }

                .cp_th {
                    /* background-color: #34ccce; */
                    padding: 10px;
                }

                .ui-flex,
                .ui-flex-center,
                .ui-flex-between,
                .ui-flex-around,
                .ui-flex-column {
                    position: relative;
                    display: -webkit-box;
                    display: -webkit-flex;
                    display: -ms-flexbox;
                    display: flex;
                    -webkit-box-align: center;
                    -webkit-align-items: center;
                    -ms-flex-align: center;
                    align-items: center;
                    color: inherit;
                }

                .ui-flex-lt {
                    -webkit-align-self: flex-start;
                    -moz-align-self: flex-start;
                    align-self: flex-start;
                }

                .ui-flex-1 {
                    -webkit-flex: 1;
                    flex: 1;
                }

                /* 文字截断 */
                .ui-nowrap,
                .ui-nowrap-flex,
                .ui-nowrap-2,
                .ui-nowrap-3 {
                    overflow: hidden;
                    text-overflow: ellipsis;
                }

                .ui-nowrap {
                    max-width: 100%;
                    white-space: nowrap;
                }

                .ui-nowrap-flex,
                .ui-nowrap-2,
                .ui-nowrap-3 {
                    display: -webkit-box;
                    /*! autoprefixer: off */
                    -webkit-box-orient: vertical;
                    /*! autoprefixer: on */
                }

                .ui-nowrap-flex {
                    -webkit-line-clamp: 1;
                    -webkit-box-flex: 1;
                    height: inherit;
                }

                /*要截断的行数*/
                .ui-nowrap-2 {
                    -webkit-line-clamp: 2;
                }

                .data-show-container {
                    background-color: #ecf0f5;
                    padding-bottom: 15px;
                }

                .data-show-wrap {
                    /* margin: 50px 0; */
                }

                .data-show-wrap .data-show-item {
                    flex: 1;
                    text-align: center;
                    font-size: 12px;
                    color: #666;
                    background-color: #fff;
                    margin: 10px;
                    border-radius: 5px;
                    padding: 20px 0;
                }

                .data-show-wrap .data-show-item .data-show-num {
                    font-size: 35px;
                    color: #333;
                }

                .sub-title {
                    background-color: #ecf0f5;
                    color: #333;
                    font-size: 20px;
                    padding-bottom: 15px;
                }

                table {
                    color: #666;
                }
            </style>
            <div class="box flat box-primary" style="border:none;">
                <div class="data-show-container">
                    <div class="ui-flex data-show-wrap">
                        <div onclick="tb(2, 1)" class="data-show-item">
                            <div class="data-show-num">{$alldata['daiwa_count']||default="0"}</div>
                            <div class="data-show-title">挖单待处理</div>
                        </div>
                        <div onclick="tb(3, 1)" class="data-show-item">
                            <div class="data-show-num">{$alldata['deal_count']||default="0"}</div>
                            <div class="data-show-title">挖单已处理</div>
                        </div>
                        <div onclick="tb('', '{$yes}')" class="data-show-item">
                            <div class="data-show-num">{$alldata['yestoday_count']||default="0"}</div>
                            <div class="data-show-title">昨天过期</div>
                        </div>
                        <div onclick="tb('', '{$today}')" class="data-show-item">
                            <div class="data-show-num">{$alldata['today_count']||default="0"}</div>
                            <div class="data-show-title">今日过期</div>
                        </div>
                        <div onclick="tb('', '{$ming}')" class="data-show-item">
                            <div class="data-show-num">{$alldata['mingday_count']||default="0"}</div>
                            <div class="data-show-title">明天过期</div>
                        </div>
                    </div>
                </div>
                <div class="box-body aaaaaa" id="{$boxId}">
                    <div class="table-wrap">
                        <div class="dataTables_tool clearfix" style="margin-top: 10px;">
                            <form>
                                <div class="input-group date" style="width: 204px; float: left;">
                                    <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                    <input type="hidden" name="start_time" class="text date"
                                        value="{:I('get.start_time')}" />
                                    <input style="width: auto;" type="text" data-name="start_time"
                                        class="form-control date datepicker" value="{:I('get.start_time')}"
                                        placeholder="请选择开始日期" data-type="date" />
                                </div>
                                <div class="input-group date" style="width: 204px; float: left;margin-left: 10px;">
                                    <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                                    <input type="hidden" name="end_time" class="text date"
                                        value="{:I('get.end_time')}" />
                                    <input style="width: auto;" type="text" data-name="end_time"
                                        class="form-control date datepicker" value="{:I('get.end_time')}"
                                        placeholder="请选择结束日期" data-type="date" />
                                </div>
                                <div class="input-group date" style="width: 204px; float: left;margin-left: 10px;">
                                    <select name="state" class="form-control">
                                        <option <php>if($state == 0)echo "selected"</php> value="0">全部</option>
                                        <option <php>if($state == 1)echo "selected"</php> value="1">正常</option>
                                        <option <php>if($state == 2)echo "selected"</php> value="2">挖单待处理</option>
                                        <option <php>if($state == 3)echo "selected"</php> value="3">挖单已处理</option>
                                    </select>
                                </div>
                                <div class="input-group date" style="width: 204px; float: left;margin-left: 10px;">
                                    <input type="text" name="taobao_act_id" class="form-control" value="{:I('get.taobao_act_id')}"
                                        placeholder="输入活动ID" />
                                </div>
                                <button style="line-height: 20px;margin-top:auto;margin-left: 10px;" type="submit"
                                    class="btn btn-flat _dt_btns_ btn-default" data-callback="form" data-param=""> 搜索
                                </button>
                            </form>
                        </div>
                        <table id="{$tableId}4" class="table table-bordered table-hover table-condensed table-nowrap"
                            style="margin-top: 10px;" data-table-name="{$tableId}4">
                            <thead>
                                <tr>
                                    <th style="text-align: center;vertical-align: middle; width: 350px;">商品信息</th>
                                    <th style="text-align: center;width: 180px;">排期时间</th>
                                    <th style="text-align: center">佣金比率</th>
                                    <th style="text-align: center">状态</th>
                                    <th style="text-align: center">所有者</th>
                                    <th style="text-align: center;width: 150px;">操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <if condition="$list">
                                    <foreach name="list" item="row2">
                                        <tr>
                                            <td>
                                                <a href="{$row2['goods_url']}" target="_blank" style="display: block;">
                                                    <div style="color: black" class="ui-flex">
                                                        <div style="border:1px solid #ddd">
                                                            <img src="{$row2['logo_img']}" width="80px" />
                                                        </div>
                                                        <div class="ui-flex-lt" style="margin-left: 5px;">
                                                            <div class="ui-nowrap-2" style="white-space: normal"
                                                                title="{$row2['title']}"> {$row2['title']}
                                                            </div>
                                                            <div style="">价格:&nbsp;&nbsp;{$row2['price']}</div>
                                                            <div style="">销量:&nbsp;&nbsp;{$row2['inOrderCount']}</div>
                                                        </div>
                                                    </div>
                                                </a>
                                            </td>
                                            <td style="text-align: left;vertical-align:middle;">
                                                活动：{$row2['taobao_act_id']}<br>
                                                起：{$row2['startDate']}<br>
                                                止：{$row2['endDate']}
                                            </td>
                                            <td style="text-align: center;vertical-align:middle;">
                                                原：{$row2['commisionRatioWl']}<br>
                                                现：{$row2['commissionRateNow']}
                                            </td>

                                            <td style="text-align: center;width: 120px;vertical-align:middle;">
                                                {$row2['state_label']}
                                            </td>
                                            <td style="text-align: center;vertical-align:middle;">
                                                {$row2['m_nickname']}
                                            </td>

                                            <td style="text-align: center; width: 210px;;vertical-align:middle;">
                                                <div>
                                                    {$row2['operate']}

                                                </div>
                                            </td>
                                        </tr>
                                    </foreach>
                                    <else />
                                    <tr>
                                        <td colspan="11"
                                            style="height: 200px; margin: 0px auto; text-align: center; vertical-align: middle; line-height: 200px;">
                                            暂无数据，或维护中.. </td>
                                    </tr>
                                </if>
                            </tbody>
                        </table>
                        <div style="text-align: center;font-size: large;margin-top: 6px;">{$page}</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(function () {
            $('.form-control.date.datepicker').change(function () {
                $(this).prev().val($(this).val());
            });

            $('.datepicker').each(function () {
                var $this = $(this);
                var dateType = $(this).attr('data-type');
                var handle = "datepicker";
                var format = "yyyy-mm-dd";
                var options = {
                    language: 'zh-CN',
                    autoclose: true,
                    templates: {
                        leftArrow: '<i class="fa fa-caret-square-o-left"></i>',
                        rightArrow: '<i class="fa fa-long-arrow-right"></i>'
                    },
                }
                switch (dateType) {
                    case 'timestamp':
                    case 'datetime':
                        format = "yyyy-mm-dd hh:ii";
                        handle = 'datetimepicker';
                        break;
                    case 'date':
                        format = "yyyy-mm-dd";
                        handle = 'datepicker';
                        break;
                }
                options.format = format;
                var fieldName = $this.attr('data-name');
                $this[handle](options)
                    .on('changeDate,change', function (e) {
                        var value = $(e.currentTarget).val();
                        $('input[name=' + fieldName + ']').val(value);
                    });
            });
        });

        function dealWadan(id){
            $.ajax({
                type: "POST",
                url: "/kcadmin/data/dealWandan?id="+id,
                contentType : "application/json",
                dataType : "json",
                data: {
                    id: id
                },
                success: function(data) {
//                alert("Data Saved: " + data.error_msg);
                    if(data.code){
                        alert(data.msg);
                        setTimeout(send, 1000)

                    }else{
                        alert(data.msg);
                    }

                }
            });
        }

        function send() {
            location.reload();
        }

        function tb(state, time){
            url = '/kcadmin/data/goodslist?state='+state;
            if(time != 1){
                url = url+'&start_time='+time+' 00:00:00'+'&end_time='+time+' 23:59:59'
            }
            location.href = url;
        }
    </script>
</block>